package com.pengchuang.ACS.admin.boot.controller;

import java.util.Arrays;
import java.util.Map;

import com.pengchuang.ACS.admin.boot.entity.SysOauthClient;
import com.pengchuang.ACS.admin.boot.service.ISysOauthClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.pengchuang.ACS.admin.boot.entity.SysOauthClientEntity;
import com.pengchuang.ACS.common.utils.PageUtils;
import com.pengchuang.ACS.common.utils.R;



/**
 * 
 *
 * @author pengchaung
 * @email pengshi12138@outlook.com
 * @date 2023-03-14 15:33:20
 */
@RestController
@RequestMapping("/admin/oauthclient")
public class SysOauthClientController {
    @Autowired
    private ISysOauthClientService sysOauthClientService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sysOauthClientService.queryPage(params);

        return R.ok().put("result", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{clientId}")
    public R info(@PathVariable("clientId") String clientId){
        SysOauthClient sysOauthClient = sysOauthClientService.getById(clientId);

        return R.ok().put("result", sysOauthClient);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody SysOauthClient sysOauthClient){
		sysOauthClientService.save(sysOauthClient);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody SysOauthClient sysOauthClient){
		sysOauthClientService.updateById(sysOauthClient);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] clientIds){
		sysOauthClientService.removeByIds(Arrays.asList(clientIds));

        return R.ok();
    }

}
